use std::io;

fn main() 
{
    
    // User input of weight
    println!("Please enter your weight (in kg): ");
    let mut weight = String::new();

        io::stdin()
        .read_line(&mut weight)
        .expect("Failed to read line");

    let weight: f32 = weight.trim().parse().expect("Failed to read line");

    // User input of height
    println!("Please enter your height (in meters): ");
    let mut height = String::new();

        io::stdin()
        .read_line(&mut height)
        .expect("Failed to read line");

    let height: f32 = height.trim().parse().expect("Failed to read line");

    // Body Mass Index, derived from dividing weight and height to the power of 2.
    let user_bmi: f32 = weight / (height.powf(2.0));

    if user_bmi < 17.5
    {
        println!("Impossible BMI ( {} )", user_bmi)
    }
    else if user_bmi <= 18.5 && user_bmi < 19.0
    {
        println!("Underweight, BMI {}", user_bmi)
    }
    else if user_bmi >= 18.5 && user_bmi < 25.0
    {
        println!("Normal weight, BMI {}", user_bmi)
    }
    else if user_bmi >= 25.0 && user_bmi < 30.0
    {
        println!("Overweight, BMI {}", user_bmi)
    }
    else if user_bmi >= 30.0 && user_bmi < 55.0
    {
        println!("Obese, BMI {}", user_bmi)
    }
    else if user_bmi >= 55.0
    {
        println!("Impossible BMI {}", user_bmi)
    }
}